package com.xiaoyaoji.common.holder;

import com.xiaoyaoji.common.util.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常拦截处理器
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler({Exception.class})
    public JsonResult goodsBaseControllerException(Exception exception) {
        log.error("统一异常处理：", exception);
        return JsonResult.fail(exception.getMessage());
    }

}
